const App = getApp()
var imageUtil=require('../../utils/util.js');
Page({
    data: {
        showtab:0,
        activeIndex: 0,
        // tab切换  
        currentTab: 0,  
        navList: [],
        indicatorDots: !0,
        autoplay: true,
        current: 0,
        interval: 3000,
        duration: 1000,
        circular: !0,
        prompt: {
            hidden: !0,
        },
        phtotList:[],//休闲照片
    },
    onLoad() {
       // this.getBanners()
    },
    onShow:function(){
        this.setData({
                    showtab:0,
        activeIndex: 0,
        // tab切换  
        currentTab: 0,  
        navList: [],
        indicatorDots: !0,
        autoplay: true,
        current: 0,
        interval: 3000,
        duration: 1000,
        circular: !0,
        prompt: {
            hidden: !0,
        },
        phtotList:[],//休闲照片
        })
        this.getBanners()
    },
    getNavList:function(){
        this.setData({
            navList:{
                tabnum:3,
                list:[
                    {
                        text:"休闲照片",
                        icon:"../../assets/images/man.png",
                        id:"1"
                    },
                    {
                        text:"儿童照片",
                        icon:"../../assets/images/samll.png",
                        id:"2"
                    },
                    {
                        text:"婚纱照片",
                        icon:"../../assets/images/hunsha.png",
                        id:"3"
                    }
                ]
            }  
        })
        this.getPhotoAll(1)
    },
    
   swichNav: function( e ) {  
     //  console.log(e);return;
     var that = this;  
      this.getPhotoAll(e.currentTarget.dataset.type)  
      that.setData( {  
        currentTab: e.target.dataset.current  
      })  
 
    }  ,
   
    showImageDetail:function(e){
        App.WxService.navigateTo('../show/index', {
            pid: e.currentTarget.dataset.pid,
            timestamp:e.currentTarget.dataset.timestamp
        })
    },

   getPhotoAll:function(id){
       var that=this
        wx.showToast({
            title: '加载中',
            icon: 'loading',
            duration: 10000
            })
       wx.request({
         url: 'https://www.sjwwljs.cn/Api/User/getShow',
         data: {id:id},
         method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
        header: {
            'content-type': 'application/json'
        },
         success: function(res){
              wx.hideToast()
            that.setData({
                phtotList:res.data.list
            })
         },
       })    
   } ,

    

   getBanners:function(){
      var that=this
      wx.showToast({
            title: '加载中',
            icon: 'loading',
            duration: 10000
            })
       wx.request({
         url: 'https://www.sjwwljs.cn/Api/User/getBanner',
         method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
         header: {
            'content-type': 'application/json'
        },
         success: function(res){
                wx.hideToast()
            that.setData({banner:res.data.item})
            that.getNavList()
        
         },
       })     
   },
   onShareAppMessage:function(){
       return {
           title:"分享",
           path:"pages/index/index"
       }
   },
   imageLoad:function(e){
     
    var iamge =imageUtil.imagesSuo(e,250,250)
    this.setData({  
      imagewidth: iamge.imageWidth,  
      imageheight: iamge.imageHeight  
    })  
  },
  
})
